<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePayAnalyzeTables extends Migration
{
    /**
     * Run the migrations.
     * 付费分析LTV.
     */
    public function up()
    {
        Schema::create('pay_analyzes', function (Blueprint $table) {
            $table->increments('id');
            $table->date('date_time')->comment('日期');
            $table->tinyInteger('type')->comment('类型:1全服,2渠道,3区服');
            $table->integer('server_id')->default(0)->comment('区服ID');
            $table->integer('channel_id')->default(0)->comment('渠道ID');
            $table->smallInteger('new_users')->comment('新增用户');
            $table->decimal('first_day_amount')->comment('首日充值');
            $table->decimal('total_amount')->comment('累计充值');
            $table->decimal('one_day_ltv')->default(0)->comment('首日ltv');
            $table->decimal('two_day_ltv')->default(0)->comment('两日ltv');
            $table->decimal('three_day_ltv')->default(0)->comment('三日ltv');
            $table->decimal('four_day_ltv')->default(0)->comment('四日ltv');
            $table->decimal('five_day_ltv')->default(0)->comment('五日ltv');
            $table->decimal('six_day_ltv')->default(0)->comment('六日ltv');
            $table->decimal('seven_day_ltv')->default(0)->comment('七日ltv');
            $table->decimal('fifteen_day_ltv')->default(0)->comment('十五日ltv');
            $table->decimal('thirty_day_ltv')->default(0)->comment('三十日ltv');
            $table->timestamps();
            $table->index('type');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('pay_analyzes');
    }
}
